/*
 * TransactionLineBO.java
 *
 * Created on March 7, 2007, 1:15 PM
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package Data;

/**
 *
 * @author Danny Beutler
 */
public class TransactionLineBO {
    private String id;
    private TransactionBO transaction;
    private RevenueSourceBO revenueSource;
    private CouponBO coupon;
    private boolean alreadyInDB=false;
    private boolean dirty=true;
    /** Creates a new instance of TransactionLineBO */
    public TransactionLineBO(String GUID) {
        this.id=GUID;
    }
    
    /** Gets the employee GUID */
    public String getId() {
        return id;
    }
    
    /** Gets the transactionLine's transaction */
    public TransactionBO getTransaction() {
        return transaction;
    }
    
    /** Sets the transactionLine transaction */
    public void setTransaction(TransactionBO transaction) {
        dirty=true;
        this.transaction = transaction;
    }
    
    /** Gets the transactionLine revenueSource */
    public RevenueSourceBO getRevenueSource() {
        return revenueSource;
    }
    
    /** Sets the transactionLine revenueSource */
    public void setRevenueSource(RevenueSourceBO revenueSource) {
        dirty=true;
        this.revenueSource = revenueSource;
    }
    
    /** Gets the transactionLine coupon */
    public CouponBO getCoupon() {
        return coupon;
    }
    
    /** Sets the transactionLine coupon */
    public void setCoupon(CouponBO coupon) {
        dirty=true;
        this.coupon = coupon;
    }
    
    /** Gets the transactionLine alreadyInDB variable */
    public boolean isAlreadyInDB() {
        return alreadyInDB;
    }
    
    /** Sets the transactionLine alreadyInDB variable*/
    public void setAlreadyInDB(boolean alreadyInDB) {
        this.alreadyInDB = alreadyInDB;
    }
    
    /** Gets the transactionLine dirty variable */
    public boolean isDirty() {
        return dirty;
    }
    
    /** Sets the transactionLine dirty variable */
    public void setDirty(boolean dirty) {
        this.dirty = dirty;
    }
    
    
    /** Calculates the transactionLine price */
    public double getTotalPrice(){
        double price = this.getRevenueSource().getPrice();
        if(coupon!=null){
            price -= coupon.getAmount();
        }
        return price;
    }
}
